
#pragma once


namespace __OCF_STUB__ 
{


using namespace __OCF_BASE__;

template <class IF>
class CUserToGateway
{
	typedef TYPE_LIST07(BYTE,BYTE*,USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnCharLoading__ = 151,
		__ENUM_FUNCTION_TYPE_fnCharCreate__ = 152,
		__ENUM_FUNCTION_TYPE_fnCharDelete__ = 153,
		__ENUM_FUNCTION_TYPE_fnCharSelect__ = 154,

		__END__
	};
	typedef IF _N_IF_T;
	typedef long (CUserToGateway<_N_IF_T>::*_FUNC_T)(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn);

public:
	CUserToGateway(_N_IF_T* pcIf)
		:m_pcIf(pcIf)
	{
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
		m_ulBindX = 0;
		m_ulIdentity = 0;

		memset(m_apcFunc, 0x00, sizeof(m_apcFunc));

		m_apcFunc[__ENUM_FUNCTION_TYPE_fnCharLoading__] = &CUserToGateway<_N_IF_T>::fnCharLoading;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnCharCreate__] = &CUserToGateway<_N_IF_T>::fnCharCreate;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnCharDelete__] = &CUserToGateway<_N_IF_T>::fnCharDelete;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnCharSelect__] = &CUserToGateway<_N_IF_T>::fnCharSelect;

	}
	virtual ~CUserToGateway()
	{
	}
	CUserToGateway& operator =(const CUserToGateway& cFrom)
	{
		m_pcIf = cFrom.m_pcIf;
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
		m_ulBindX = cFrom.m_ulBindX;
		m_ulIdentity = cFrom.m_ulIdentity;

		return *this;
	}
	long StubDispatch()
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cIn(m_ulLenRcvBuff, m_pRcvBuff);
		USHORT uiCmd;

		if (FALSE == cIn.Pop(uiCmd).IsValid())
		{
			return -2;
		}
		if (uiCmd >= __END__)
		{
			return -3;
		}
		if (NULL == m_apcFunc[uiCmd])
		{
			return -4;
		}
		return (this->*m_apcFunc[uiCmd])(cIn);
	}

public:
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff, ULONG ulLenSndBuff = 0, void* pSndBuff = NULL) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }

private:
	inline ULONG GetBindX() { return m_ulBindX; }
	inline ULONG GetIdentity() { return m_ulIdentity; }
private:
	long fnCharLoading(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnCharLoading(GetBindX(),GetIdentity());
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnCharCreate(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE bySlot;ULONG nLenCharName;char * pszCharName;char nGender;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(bySlot).Pop(nLenCharName,(const char ** )(&pszCharName)).Pop(nGender).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnCharCreate(GetBindX(),GetIdentity(),bySlot,(int )nLenCharName,pszCharName,nGender);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnCharDelete(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE bySlot;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(bySlot).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnCharDelete(GetBindX(),GetIdentity(),bySlot);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnCharSelect(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE bySlot;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(bySlot).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnCharSelect(GetBindX(),GetIdentity(),bySlot);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}

private:
	_FUNC_T m_apcFunc[__END__];
	_N_IF_T* m_pcIf;
	ULONG m_ulLenRcvBuff;
	ULONG m_ulLenSndBuff;
	const void* m_pRcvBuff;
	void* m_pSndBuff;
	ULONG m_ulBindX;
	ULONG m_ulIdentity;
};

}
#pragma once


namespace __OCF_STUB__ 
{


using namespace __OCF_BASE__;

template <class IF>
class CGatewayToUser
{
	typedef TYPE_LIST07(BYTE,BYTE*,USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnResultCharLoading__ = 551,
		__ENUM_FUNCTION_TYPE_fnResultCharCreate__ = 552,
		__ENUM_FUNCTION_TYPE_fnResultCharDelete__ = 553,
		__ENUM_FUNCTION_TYPE_fnResultCharSelect__ = 554,

		__END__
	};
	typedef IF _N_IF_T;
	typedef long (CGatewayToUser<_N_IF_T>::*_FUNC_T)(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn);

public:
	CGatewayToUser(_N_IF_T* pcIf)
		:m_pcIf(pcIf)
	{
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
		m_ulBindX = 0;
		m_ulIdentity = 0;

		memset(m_apcFunc, 0x00, sizeof(m_apcFunc));

		m_apcFunc[__ENUM_FUNCTION_TYPE_fnResultCharLoading__] = &CGatewayToUser<_N_IF_T>::fnResultCharLoading;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnResultCharCreate__] = &CGatewayToUser<_N_IF_T>::fnResultCharCreate;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnResultCharDelete__] = &CGatewayToUser<_N_IF_T>::fnResultCharDelete;
		m_apcFunc[__ENUM_FUNCTION_TYPE_fnResultCharSelect__] = &CGatewayToUser<_N_IF_T>::fnResultCharSelect;

	}
	virtual ~CGatewayToUser()
	{
	}
	CGatewayToUser& operator =(const CGatewayToUser& cFrom)
	{
		m_pcIf = cFrom.m_pcIf;
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
		m_ulBindX = cFrom.m_ulBindX;
		m_ulIdentity = cFrom.m_ulIdentity;

		return *this;
	}
	long StubDispatch()
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cIn(m_ulLenRcvBuff, m_pRcvBuff);
		USHORT uiCmd;

		if (FALSE == cIn.Pop(uiCmd).IsValid())
		{
			return -2;
		}
		if (uiCmd >= __END__)
		{
			return -3;
		}
		if (NULL == m_apcFunc[uiCmd])
		{
			return -4;
		}
		return (this->*m_apcFunc[uiCmd])(cIn);
	}

public:
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff, ULONG ulLenSndBuff = 0, void* pSndBuff = NULL) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }

private:
	inline ULONG GetBindX() { return m_ulBindX; }
	inline ULONG GetIdentity() { return m_ulIdentity; }
private:
	long fnResultCharLoading(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE byRes;ULONG nLenCharData;char * pCharData;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(byRes).Pop(nLenCharData,(const char ** )(&pCharData)).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnResultCharLoading(GetBindX(),GetIdentity(),byRes,(int )nLenCharData,pCharData);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnResultCharCreate(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE byRes;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(byRes).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnResultCharCreate(GetBindX(),GetIdentity(),byRes);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnResultCharDelete(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE byRes;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(byRes).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnResultCharDelete(GetBindX(),GetIdentity(),byRes);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}
	long fnResultCharSelect(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		BYTE byRes;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(byRes).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnResultCharSelect(GetBindX(),GetIdentity(),byRes);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
	}

private:
	_FUNC_T m_apcFunc[__END__];
	_N_IF_T* m_pcIf;
	ULONG m_ulLenRcvBuff;
	ULONG m_ulLenSndBuff;
	const void* m_pRcvBuff;
	void* m_pSndBuff;
	ULONG m_ulBindX;
	ULONG m_ulIdentity;
};

}